package com.biz.primus.model.cart.vo;

import com.biz.primus.base.global.GlobalValue;
import com.biz.primus.base.global.Ref;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.apache.commons.lang3.StringUtils;

import javax.validation.constraints.NotNull;
import java.io.Serializable;

/**
 * CartBaseRequestVo
 *
 * @author jia JKLiues
 * @date 2017年09月20日
 * @reviewer
 * @see
 */
@Getter
@Setter
@ToString
@ApiModel("购物车基础VO")
public class CartBaseReqVo implements Serializable {

    private static final long serialVersionUID = -2777399496298176062L;
    @ApiModelProperty(value = "用户ID", required = true)
    @Ref(GlobalValue.memberId)
    private Long userId;

    @NotNull(message = "用户等级不能为空")
    @ApiModelProperty(value = "用户等级", required = true)
    private Integer userLevel;

    @ApiModelProperty(value = "立即送")
    private Boolean fastMode = Boolean.FALSE;

    @ApiModelProperty(value = "经度", required = true)
    @Ref(GlobalValue.lon)
    private String lon;

    @ApiModelProperty(value = "纬度", required = true)
    @Ref(GlobalValue.lat)
    private String lat;

    @ApiModelProperty(value = "门店编码", required = true)
    @Ref(GlobalValue.depotCode)
    private String depotCode;

    public Boolean hasLocation() {
        return StringUtils.isNotBlank(lon) && StringUtils.isNotBlank(lat);
    }

}